import {makeAutoObservable} from 'mobx';
import {UserPhoto, UserRole} from './interface.ts';
import {ROLE_TYPE} from "../config/enum.ts";

export class UserEntity {
  _initialized = false;
  authenticated = false;

  id: string = '-1';
  username: string = '';
  email: string = '';
  mobileNumber: string = '';
  firstName: string = '';
  lastName: string = '';
  signUpDate: string = '';
  signUpFrom: string = '';
  createdAt: string = '';
  updatedAt: string = '';
  role: UserRole = {
    _id: '-1',
    name: '',
    description: '',
    isActive: false,
    type: ROLE_TYPE.USER,
    permissions: [],
    createdAt: '',
    updatedAt: '',
  };
  photo: UserPhoto | null = null;

  constructor(param?: UserEntity) {
    makeAutoObservable(this);
    if (param) {
      Object.assign(this, param);
    }
  }
}
